/*
 * Copyright 2024 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef UTILS_H
#define UTILS_H

#include <string>
#include <cstdint>
#include <vector>

namespace utils {

std::string generateUUID();
std::vector<double> convertFloatToDouble(const std::vector<float>& floatVec);
std::string base64Encode(const std::string& input);
std::string readImageFile(const std::string& filePath);
std::string encodeImageToBase64(const std::string& filePath);

}

namespace math {
    void normalize(std::vector<float> &vec);
    float norm(const std::vector<float> &matrix);
    void normalizeTokens(std::vector<int64_t> &tokens, int length);

}

namespace text {
    void applyRegex(std::string &text);
    std::vector<std::string> splitSentences(const std::string &text, int maxLength);
    void segmentTokenize(std::vector<std::string> &texts, int maxLength);

    std::string removeFirstLineWithPrefix(const std::string &input, const std::string &prefix);
}

#endif // UTILS_H
